<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<!-- 下拉框 -->
<link rel="stylesheet" href="/static/ace/css/chosen.css" />
<!-- 日期框 -->
<link rel="stylesheet" href="/static/ace/css/datepicker.css" />
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<link rel="stylesheet" href="/layui/css/layui.css">
<script src="/layui/layui.js"></script>
<script src="/static/ace/js/bootbox.js"></script>
<!-- ace scripts -->
<script src="/static/ace/js/ace/ace.js"></script>
<!-- 下拉框 -->
<script src="/static/ace/js/chosen.jquery.js"></script>
<!-- 日期框 -->
<script src="/static/ace/js/date-time/bootstrap-datepicker.js"></script>
<!--提示框-->
<script type="text/javascript" src="/static/js/jquery.tips.js"></script>
<style type="text/css">
.layui-table-tips-main {
	display: none
}

.layui-table-tips-c {
	display: none
}
</style>
</head>
<body class="layui-layout-body"
	style="overflow-y: auto; overflow-x: hidden;">
	<form class="layui-form" style="padding: 10px 50px 10px 10px;">
		<div class="layui-form-item">
			<div class="layui-row">
				<div class="layui-col-md4">
					<label class="layui-form-label">用户姓名</label>
					<div class="layui-input-block">
						<input type="text" name="name" id="name" lay-verify="required"
							placeholder="用户姓名" autocomplete="off" class="layui-input"
							th:value="${user.name}" readonly="readonly">
					</div>
				</div>
				<div class="layui-col-md4">
					<label class="layui-form-label">用户电话</label>
					<div class="layui-input-block">
						<input type="text" name="phone" id="phone" lay-verify="required"
							placeholder="用户电话" autocomplete="off" class="layui-input"
							th:value="${user.phone}" readonly="readonly">
					</div>
				</div>
				<div class="layui-col-md4">
					<label class="layui-form-label">用户邮箱</label>
					<div class="layui-input-block">
						<input type="text" name="email" id="email" lay-verify="required"
							placeholder="用户邮箱" autocomplete="off" class="layui-input"
							th:value="${user.email}" readonly="readonly">
					</div>
				</div>
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-col-md4">
				<label class="layui-form-label">头像地址</label>
				<div class="layui-input-block">
					<input type="text" name="img" id="img" lay-verify="required"
						placeholder="用户年龄" onkeyup="num(this)" autocomplete="off"
						class="layui-input" th:value="${user.img}" readonly="readonly">
				</div>
			</div>

			<div class="layui-col-md4">
				<label class="layui-form-label">用户年龄</label>
				<div class="layui-input-block">
					<input type="text" name="age" id="age" lay-verify="required"
						placeholder="用户年龄" onkeyup="num(this)" autocomplete="off"
						class="layui-input" th:value="${user.age}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4">
				<label class="layui-form-label">用户性别</label>
				<div class="layui-input-block">
					<input type="text" name="sex" id="sex" lay-verify="required"
						placeholder="用户性别" onkeyup="num(this)" autocomplete="off"
						class="layui-input"
						th:value="${user.sex==0?'保密':user.sex==1?'男':'女'}"
						readonly="readonly">
				</div>
			</div>

		</div>

		<div class="layui-form-item">
			<div class="layui-col-md4" th:if="${user.jurisdiction==0}">
				<label class="layui-form-label">用户年级</label>
				<div class="layui-input-block" id="grade">
					<input type="text" name="school" id="school" lay-verify="required" placeholder="用户年级" 
					onkeyup="num(this)" autocomplete="off" class="layui-input"
					th:value="${user.grade==0?'未设置':user.grade==1?'初三以下':user.grade==2?'初三'
					:user.grade==3?'高一':user.grade==4?'高二':user.grade==5?'高三':'高三以上'}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4" th:if="${user.jurisdiction==1}">
				<label class="layui-form-label">用户学历</label>
				<div class="layui-input-block" id="grade">
					<input type="text" name="school" id="school" lay-verify="required" placeholder="用户学历" 
					onkeyup="num(this)" autocomplete="off" class="layui-input"
					th:value="${user.educationbackground}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4"  th:if="${user.jurisdiction==0}">
				<label class="layui-form-label">用户学校</label>
				<div class="layui-input-block">
					<input type="text" name="school" id="school" lay-verify="required"
						placeholder="用户学校" onkeyup="num(this)" autocomplete="off"
						class="layui-input" th:value="${user.school}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4"  th:if="${user.jurisdiction==1}">
				<label class="layui-form-label">毕业院校</label>
				<div class="layui-input-block">
					<input type="text" name="school" id="school" lay-verify="required"
						placeholder="毕业院校" onkeyup="num(this)" autocomplete="off"
						class="layui-input" th:value="${user.educationbackground}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4">
				<label class="layui-form-label">用户生日</label>
				<div class="layui-input-block">
					<input type="text" name="brithday" id="brithday"
						lay-verify="required" placeholder="用户生日" onkeyup="num(this)"
						autocomplete="off" class="layui-input" th:value="${user.brithday}"
						readonly="readonly">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-col-md4">
				<label class="layui-form-label">注册时间</label>
				<div class="layui-input-block">
					<input type="text" name="createTime" id="createTime"
						lay-verify="required" placeholder="注册时间" onkeyup="num(this)"
						autocomplete="off" class="layui-input"
						th:value="${user.createtime}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4">
				<label class="layui-form-label">用户类型</label>
				<div class="layui-input-block">
					<input type="text" name="jurisdiction" id="jurisdiction"
						lay-verify="required" placeholder="用户类型" onkeyup="num(this)"
						autocomplete="off" class="layui-input"
						th:value="${user.jurisdiction==0?'学生':'教师'}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4">
				<label class="layui-form-label">是否申述</label>
				<div class="layui-input-block">
					<input type="text" name="isstate" id="isstate"
						lay-verify="required" placeholder="否" onkeyup="num(this)"
						autocomplete="off" class="layui-input"
						th:value="${user.isstate==0}?'否':'是'" readonly="readonly">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-col-md4">
				<label class="layui-form-label">是否被举报</label>
				<div class="layui-input-block">
					<input type="text" name="isreport" id="isreport"
						lay-verify="required" placeholder="是否被举报" onkeyup="num(this)"
						autocomplete="off" class="layui-input"
						th:value="${user.isreport==0?'否':'是'}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md3">
				<label class="layui-form-label">是否被封禁</label>
				<div class="layui-input-block">
					<input type="text" name="isbanned" id="isbanned"
						lay-verify="required" placeholder="是否被封禁" onkeyup="num(this)"
						autocomplete="off" class="layui-input"
						th:value="${user.isbanned==0?'否':'是'}" readonly="readonly">
				</div>
			</div>
		</div>
		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">个性签名</label>
			<div class="layui-input-block">
				<textarea placeholder="请输入内容" class="layui-textarea"
					readonly="readonly"></textarea>
			</div>
		</div>
		<br><br>
		<div class="layui-col-md12" style="padding: 10px 50px 10px 10px;">
			<h1 style="padding-left: 40px;">举报时间及理由：</h1><br>
			<span th:if="${#lists.isEmpty(reportList)}" style="padding-left: 40px;">&emsp;暂无举报信息</span>
			<span th:if="${not #lists.isEmpty(reportList)}">
			<ul class="layui-timeline">
			  <li class="layui-timeline-item" th:each="reportMap : ${reportList}">
			    <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
			    <div class="layui-timeline-content layui-text">
			      <h3 class="layui-timeline-title">[[${reportMap.time}]]</h3>
			      <p>
			      	<span th:each="report: ${reportMap.message}">
			      		<span>用户[[${report.uname}]]在[[${report.rdate}]]举报了该用户，理由：[[${report.rmessage}]]</span><br>
			      	</span>
			      </p>
			    </div>
			  </li>
			</ul>
			</span>
		</div>
		<div
			style="text-align: center; margin-top: 30px; margin-bottom: 20px;">
			<span type="button" class="layui-btn layui-btn-primary" onclick="closeDialog();"
				id="closeDialog">&emsp;取消&emsp;</span>
			<span type="button" class="layui-btn layui-btn-warm"
				id="reset" th:attr="onclick='reset('+${user.id}+','+${user.account}+');'">用户操作详情</span>
			<span type="button" class="layui-btn layui-btn-normal" th:attr="onclick='neglect('+${user.id}+','+${user.account}+');'"
				id="closeDialog">&emsp;忽略&emsp;</span>
			<span id="btnSubmit" type="button" th:if="${user.isbanned==0}" th:attr="onclick='titles('+${user.id}+','+${user.account}+');'"
				class="layui-btn layui-btn-danger" disabled="true">
				&emsp;封号&emsp;</span>
			<span id="btnSubmit" type="button" th:if="${user.isbanned==1}" th:attr="onclick='deblocking('+${user.id}+','+${user.account}+');'"
				class="layui-btn"  disabled="true">
				&emsp;解封&emsp;</span>
		</div>
	</form>
	<script type="text/javascript">
	//用户操作详情
	function reset(id,account){
		let params = {};
		params.id = id;
		params.account = account;
		$.ajax({
			url : '/admin/account/reset',
			type : 'post',
			data : params,
			dataType : 'json',
			success : function(data) {
				if (data.code == 0) {
					let linkmanAndGroupChat = '<table class="layui-table"><colgroup><col width="170"><col width="100"><col></colgroup>'
					  +'<thead><tr><th>时间</th><th>场景</th><th>内容</th></tr></thead>';
					  var data2 = eval(data.resultList);
		      		  for(let i in data2){
		      			linkmanAndGroupChat += '<tbody><tr><td>'+data2[i].cdate+'</td><td>聊天</td><td>'+data2[i].message+'</td></tr></tbody>';
		      		  }
		      		  var data2 = eval(data.commenttopics);
		      		  for(let i in data2){
		      			linkmanAndGroupChat += '<tbody><tr><td>'+data2[i].cdate+'</td><td>评论</td><td>'+data2[i].cmessage+'</td></tr></tbody>';
		      		  }
		      		linkmanAndGroupChat += '</table>';
					let index = layer.open({
				        title: '用户操作详情'
				        , btn: ['关闭']
						, area: ['800px','600px']
				        , content: linkmanAndGroupChat
				        , yes: function () {
				        	layer.close(layer.index);
				        }
					});
				} else {
					layer.msg(data.msg, {icon : 2 });
				}
			}
		});
	}
	//封号
	function titles(id,account){
		layer.confirm('确定要对该账号进行封禁？', function(index){
	        var params={};
			params.id=id;
			params.message = '';
			$.ajax( {
		         url : '/admin/account/title', 
		         type : 'post',
		         data: params,
		         dataType : 'json',
		         success : function(data) {
		        	 if(data.code==0){
		        		 layer.msg(data.msg,{icon: 1});
		        		 setTimeout(function(){
		        			 closeDialog();
						 },1500);
		        	 }else{
		        		 layer.msg(data.msg,{icon: 2});
		        	 }
		         }
		     });
	    });
	}
	//解封
	function deblocking(id,account){
		var params={};
		params.id=id;
		$.ajax( {
	         url : '/admin/account/deblocking', 
	         type : 'post',
	         data: params,
	         dataType : 'json',
	         success : function(data) {
	        	 if(data.code==0){
	        		 layer.msg(data.msg,{icon: 1});
	        		 setTimeout(function(){
	        			 closeDialog();
					 },1500);
	        	 }else{
	        		 layer.msg(data.msg,{icon: 2});
	        	 }
	         }
	     });
	}
	//忽略
	function neglect(id,account){
		var params={};
		params.id=id;
		$.ajax( {
	         url : '/admin/account/neglect', 
	         type : 'post',
	         data: params,
	         dataType : 'json',
	         success : function(data) {
	        	 if(data.code==0){
	        		 layer.msg(data.msg,{icon: 1});
	        		 setTimeout(function(){
	        			 closeDialog();
					 },1500);
	        	 }else{
	        		 layer.msg(data.msg,{icon: 2});
	        	 }
	         }
	     });
	}
	//关闭页面
	function closeDialog(){
		var index = parent.layer.getFrameIndex(window.name);
		parent.layer.close(index);
	}
	</script>
	<script>
		layui
				.use(
						[ 'form', 'layedit', 'laydate' ],
						function() {
							var form = layui.form, layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate;
						});
		layui.use('element', function(){
			  var element = layui.element;
			});
	</script>
	<script type="text/javascript">
		$(top.hangge());//关闭加载状态
	</script>


</body>
</html>